package test.spring.annotation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service
public class SimpleMan {
	// 自动注入名称为 Man 的 Bean
	@Autowired(required = false)
	@Qualifier("chineseMan")
	// @Qualifier("usMan")
	private IMan man;

	/**
	 * @return the man
	 */
	public IMan getMan() {
		return man;
	}

	/**
	 * @param man
	 *            the man to set
	 */
	public void setMan(IMan man) {
		this.man = man;
	}

	public String hello() {
		System.out.println("man.sayHello()=" + man.sayHello());
		return "SimpleMan said: Hi";
	}
}
